package com.woniu.elderly.serve.feignclient;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.woniu.common.dto.ServeAuditDTO;
import com.woniu.common.dto.ServePersonDTO;
import com.woniu.common.dto.ServeWorkOrderDTO;
import com.woniu.common.entity.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(value = "elderly-service"/*, fallback = 降级方法实现类*/)
public interface ElderlyServiceFeign {
    //查询全部服务人员有参数
    @PostMapping("/serveperson/{pageIndex}/{pageSize}")
    Result<Page<ServePerson>> servePerson_findAll(@PathVariable("pageIndex") int pageIndex, @PathVariable("pageSize") int pageSize, @RequestBody ServePersonDTO servePersonDTO);

    //查询全部服务人员没有参数
    @GetMapping("/")
    Result<List<ServePerson>> findAll();

    //根据id查询服务人员
    @GetMapping("/serveperson/{id}")
    Result<ServePerson> servePerson_findById(@PathVariable("id") int id);

    //新增服务人员
    @PostMapping("/serveperson/")
    Result<String> servePerson_add(@RequestBody ServePerson servePerson);

    //修改服务人员
    @PutMapping("/serveperson/")
    Result<Void> servePerson_modify(@RequestBody ServePerson servePerson);

    //离职申请
    @GetMapping("/serveperson/apply/{id}/{cause}")
    Result<Void> servePerson_apply(@PathVariable("id") int id, @PathVariable("cause") String cause);

    //撤销申请
    @GetMapping("/serveperson/revocation/")
    Result<Void> servePerson_revocation(@RequestBody ServePerson servePerson);

    //删除服务人员
    @DeleteMapping("/serveperson/{id}")
    Result<Void> servePerson_remove(@PathVariable("id") int id);

    //随机抽一位服务人员id
    @GetMapping("/serveperson/random/{serveType}")
    Result<Integer> servePerson_random(@PathVariable("serveType") String serveType);

    //服务人员完成服务
    @GetMapping("/serveperson/finish/")
    public Result<Void> servePerson_finish(@RequestBody ServePerson servePerson);

    //查询全部审核
    @PostMapping("/serveaudit/{pageIndex}/{pageSize}")
    Result<Page<ServeAudit>> serveAudit_findAll(@PathVariable("pageIndex") int pageIndex, @PathVariable("pageSize") int pageSize, @RequestBody ServeAuditDTO serveAuditDTO);

    //根据id查询审核
    @GetMapping("/serveaudit/{id}")
    Result<ServeAudit> serveAudit_findById(@PathVariable("id") int id);

    //添加审核
    @PostMapping("/serveaudit/")
    Result<Integer> serveAudit_add(@RequestBody ServeAudit serveAudit);

    //删除审核
    @DeleteMapping("/serveaudit/{id}")
    Result<Void> serveAudit_remove(@PathVariable("id") int id);

    //修改审核
    @PutMapping("/serveaudit/")
    Result<Void> serveAudit_modify(@RequestBody ServeAudit serveAudit);

    //查询所有工单
    @PostMapping("/serveworkorder/{pageIndex}/{pageSize}")
    Result<Page<ServeWorkOrder>> serveworkorder_findAll(@PathVariable("pageIndex") int pageIndex, @PathVariable("pageSize") int pageSize, @RequestBody ServeWorkOrderDTO serveWorkOrderDTO);

    //根据id查询工单
    @GetMapping("/serveworkorder/{id}")
    Result<ServeWorkOrder> serveworkorder_findById(@PathVariable("id") int id);

    //添加工单
    @PostMapping("/serveworkorder/")
    Result<Void> serveworkorder_add(@RequestBody DealOrder dealOrder);

    //删除工单
    @DeleteMapping("/serveworkorder/{id}")
    Result<Void> serveworkorder_remove(@PathVariable("id") int id);

    //修改工单
    @PutMapping("/serveworkorder/")
    Result<Void> serveworkorder_modify(@RequestBody ServeWorkOrder serveWorkOrder);
}
